package org.lqk.file.transfer.processor;

import io.netty.channel.ChannelHandlerContext;
import org.lqk.file.transfer.protocol.CmdCode;
import org.lqk.file.transfer.protocol.RemotingCommand;
import org.lqk.file.transfer.protocol.RpcType;

/**
 * Created by a on 2015/8/27.
 */
public class DefaultProcessor implements NettyRequestProcessor {

    @Override
    public RemotingCommand processRequest(ChannelHandlerContext ctx, RemotingCommand request) throws Exception {
        String content = request.getContent();
        System.out.println("服务端接受的消息是：" + content);
        RemotingCommand remotingCommand = new RemotingCommand(CmdCode.File_Task.getCode(), RpcType.File_Response.getCode(), true,request.getOpaque());
        remotingCommand.setContent("服务端返回的消息：" + content);
        return remotingCommand;
    }

}
